package com.ecomemerce.app.comment.widgets

import androidx.compose.foundation.Image
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Divider
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Card
import androidx.compose.material3.CardElevation
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import com.ecomemerce.app.R

@Composable
@Preview
 @Stable
fun RecommendShop(){

    val products = listOf(
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("乐事薯片", "85.20 AED", "https://example.com/chips.jpg"),
        Product("新鲜白菜", "85.20 AED", "https://example.com/cabbage.jpg")
     )


    Column {
        Row(modifier = Modifier.horizontalScroll(rememberScrollState())) {
            products.forEach { it ->
                Card(
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(16.dp),
                    shape = RoundedCornerShape(8.dp),

                    ) {
                    Column(modifier = Modifier.padding(16.dp)) {
                        Row(verticalAlignment = Alignment.CenterVertically) {
                            Image(
                                painter = painterResource(id = R.drawable.ic_launcher_background),
                                contentDescription = "Shop Icon",
                                modifier = Modifier
                                    .size(100.dp)
                                    .clip(RoundedCornerShape(8.dp))
                            )
                            Spacer(modifier = Modifier.width(16.dp))
                            Column {
                                Text(
                                    text = "塔斯汀中国汉堡",
                                    fontSize = 20.sp,
                                    fontWeight = FontWeight.Bold
                                )
                                Row(verticalAlignment = Alignment.CenterVertically) {
                                    Icon(
                                        imageVector = Icons.Default.Star,
                                        contentDescription = "Rating",
                                        tint = Color(0xFFFFA500)
                                    )
                                    Text(
                                        text = "4.9",
                                        fontSize = 16.sp,
                                        color = Color.Gray
                                    )
                                }
                            }
                        }
                        Spacer(modifier = Modifier.height(8.dp))
                        Row {
                            Text(text = "人均消费: 32 AED", fontSize = 14.sp, color = Color.Gray)
                            Spacer(modifier = Modifier.width(16.dp))
                            Text(text = "月售: 245", fontSize = 14.sp, color = Color.Gray)
                        }
                        Spacer(modifier = Modifier.height(8.dp))
                        Text(text = "配送条件: 满50 AED包邮", fontSize = 14.sp, color = Color.Gray)
                    }
                }

                       }
        }
    }
}